#ifndef __OPERATORNEW__
#define __OPERATORNEW__
#include <iostream>
using namespace std;

class obj
{
public:
    /******以下是在重载new delete 操作符，而非更底层的 operator new 或者 operator delete*****/
    /*
     * @Description: 将这几个函数定义为static是说这几个函数是针对这个类的操作，跟具体的对象无关
     * @param: MemSize为要创建的内存大小
     * @return:
     */
    static void *operator new(size_t MemSize);
    /*
     * @Description:  重载delete函数
     * @param: ptr传入要删除的指针，MemSize可选，传入要删除的内存大小
     * @return:
     */
    static void operator delete(void *ptr, size_t MemSize);
    static void *operator new[](size_t MemSize);
    static void operator delete[](void *ptr, size_t MemSize);
};
#endif

void *obj::operator new(size_t MemSize)
{

    obj *p = (obj *)malloc(MemSize);
    cout << "operator new: ptr" << endl;
    return p;
}

void obj::operator delete(void *ptr, size_t MemSize)
{
    cout << "operator delete: ptr" << endl;
    free(ptr);
}

void *obj::operator new[](size_t MemSize)
{
    obj *p = (obj *)malloc(MemSize);
    cout << "operator new: ptr" << endl;
    return p;
}

void obj::operator delete[](void *ptr, size_t MemSize)
{
    cout << "operator delete: ptr" << endl;
    free(ptr);
}


pLineOrCircularArcWeldingLine = BracketPointCloudToWeldingLines(
    (Three_DPoint *)pPointCloud, PointCloudSize, &nWeldingSeamNumber, bInstallDir, m_dZPallet, 5.0, false);

pLineOrCircularArcWeldingLine = IrregularFlangeRecognizeWeldingLine(
    (Three_DPoint *)pPointCloud, PointCloudSize, &nWeldingSeamNumber, bInstallDir, m_dZPallet, false, 5.0, 0);
